from zope.component import provideUtility, getUtilitiesFor
from pydataportability.microformats.base.interfaces import IMicroformatsParser

class IDummyParser(IMicroformatsParser):
    """a dummy implementation"""


class DummyParser(object):
    """dummy parser"""
    
    def __init__(self):
        self.found=[]
    
    def checkNode(self,node):
        """check a node if some microformat might be inside"""
        classes = node.attrib.get('class','').split()
        classes = [c.lower() for c in classes]
        return 'vcard' in classes
        
    def parseNode(self,node):
        """parse a subtree"""
        self.found.append(node)

# register the dummy parser
provideUtility(DummyParser,IDummyParser,name="dummy")

